<template>
	<view class="box">
		<!-- #ifdef H5 || MP-WEIXIN -->
		<view class="">
			<uNavbar title="店铺详情" bgColor="transparent" titleStyle="#fff"></uNavbar>
			<image class="indexbg"
				src="https://images.fudiemall.com/storage/default/20250726/bbgg3a16a2c3dd45d4106c0287d98879799b104b7b8e.png"
				mode="aspectFill"></image>
		</view>
		<!-- #endif -->
		<!-- #ifdef MP-ALIPAY -->
		<NavTitle title="店铺详情"
			bgimg='https://images.fudiemall.com/storage/default/20250726/bbgg3a16a2c3dd45d4106c0287d98879799b104b7b8e.png'
			:backgroundColor='backgroundColor' titleColor="#dedede"></NavTitle>
		<!-- #endif -->
		<view class="main">
			<image class="headimg"
				src="https://images.fudiemall.com/storage/default/20250726/nnnne5d667a2f7680d131231cb959c75831937a37dfa.png"
				mode="heightFix"></image>
			<view class="top">

				<image :src="info.cover" mode="aspectFill"></image>
				<view class="right">
					<view class="name">
						{{info.name}}
					</view>
					<view class="num">
						粉丝 {{info.attach_total}} | 收藏 {{info.collect_count}} | 销量 {{info.sales_volume}}
					</view>
				</view>

			</view>
			<view class="tagwrap">
				<image class="tagimage" :src="info.attach.seller_level.name_image" mode="widthFix"></image>
				<image class="rateimg" v-for="item in info.attach.seller_level.level_data.image_data" :src="item"
					mode="aspectFill"></image>
			</view>
			<image class="level" :src="info.attach.seller_level.image" mode="aspectFill"></image>
			<view class="btn" @click="yes()"
				:class="{ 'opacity-50': info.be_collect==1, 'opacity-100':  info.be_collect==0}">
				{{info.be_collect==1?"已收藏":"收藏"}}
			</view>
		</view>
		<view class="info">
			<image
				src="https://images.fudiemall.com/storage/default/20250731/dpkb382578636403094783982af7cf0d31dacbfdc583.png"
				mode="aspectFill"></image>
			<view class="info_top">
				<view class="number">
					{{info.evaluate_rate}}
				</view>
				<view class="rate_wrap">
					<u-rate readonly size="32" v-model="info.evaluate_rate" active-color="#FAD9AC"></u-rate>
				</view>
			</view>
			<view class="allwrap">
				<view class="txt">
					消费体验
				</view>
				<view class="progess">
					<!-- 	<view class="bgg">
			
					</view> -->
					<u-line-progress height="12" class="ssss" :percentage="(info.evaluate_rate/5)*100"
						inactiveColor="#4C463B" :showText="false" activeColor="#FAD9AC"></u-line-progress>
				</view>
				<text class="price">{{info.evaluate_rate}}</text>
			</view>
		</view>
		<view class="jcxx">
			<image class="jcxxbg"
				src="https://images.fudiemall.com/storage/default/20250731/jcxxdb0be26b8b1afd8f656896cbdbbba377c55de439.png"
				mode=""></image>
			<view class="jcxxitem">
				<text>资质证照</text>
				<view class="rightsss" @click="goDetail()">
					查看 <image class="rightimg" :src="baseUrl +'/static/icon/bigright.png'" mode="aspectFill"></image>
				</view>
			</view>
		</view>
		<u-popup :show="Flag" mode="center" @close="Flag = false" closeable bgColor="transparent">
			<view class="prompt flex_ZC">
				<text class="f36">提示</text>
				<text class="prompt_tit">您确定要取消收藏吗</text>
				<view class="prompt_ntm flex_ld_a">
					<text @click="Flag = false">取消</text>
					<text @click="no">确定</text>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import {
		detail,
		collectcancel,
		collect

	} from "../../api/local.js"
	export default {
		data() {
			return {
				id: "",
				baseUrl: this.$imageBaseUrl,
				info: {
					attach: {
						seller_level: {

						}
					}
				},
				Flag: false,
			}
		},
		onLoad(e) {
			this.id = e.id
			this.getdetail()
		},

		methods: {
			goDetail() {
				uni.navigateTo({
					url: '/pagesMy/groundCat/merchantDetails?id=' + this.id
				})
			},
			no() {
				collectcancel({
					id: this.id,
					scene_type: 2
				}).then(res => {
					if (res.code == 1) {
						this.Flag = false
						this.getdetail()
					}
					uni.$u.toast(res.msg)
				})
			},
			yes() {
				if (this.info.be_collect == 0) {
					collect({
						id: this.id,
						scene_type: 2
					}).then(res => {
						if (res.code == 1) {
							this.getdetail()
						}
						uni.$u.toast(res.msg)
					})
				} else {
					this.Flag = true
				}

			},
			getdetail() {
				detail({
						id: this.id,
						latitude: uni.getStorageSync("latitude"),
						longitude: uni.getStorageSync("longitude")
					})
					.then(async (res) => {
						console.log(111, res);
						this.info = res.data;


					})
					.catch(error => {
						console.error("获取详情失败:", error);
					});
			},
		}
	}
</script>

<style lang="scss">
	.box {
		width: 750rpx;
		height: 1624rpx;
		background-color: #171413;

	}

	.opacity-50 {
		opacity: 0.5;
	}

	/deep/.u-navbar__content__title {
		color: #fff !important;

	}

	/deep/.u-navbar__content {
		color: #fff !important;
		background: transparent !important;
	}

	.indexbg {
		position: absolute;
		top: 0;
		left: 0;
		width: 750rpx;
		height: 460rpx;
		z-index: 1;

	}

	.main {
		width: 686rpx;
		height: 350rpx;
		background: rgba(39, 36, 30, 0.8);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		border: 2rpx solid;
		margin: 0 auto;
		margin-top: 50rpx;
		position: relative;
		z-index: 66;

		.headimg {
			position: absolute;
			width: 686rpx !important;
			height: 350rpx;

		}

		.level {
			position: absolute;
			top: 20rpx;
			right: 46rpx;
			width: 108rpx;
			height: 108rpx;
			border-radius: 0rpx 0rpx 0rpx 0rpx;
		}
	}

	.top {
		margin-top: 36rpx;
		margin-left: 34rpx;
		display: flex;
		position: relative;
		z-index: 999;

		>image {
			width: 96rpx;
			height: 96rpx;
			border-radius: 50%;
		}

		.right {
			display: flex;
			flex-direction: column;
			margin-left: 18rpx;

			.name {
				width: 300rpx;
				font-size: 36rpx;
				color: #FFFFFF !important;
				white-space: nowrap;
				/* 防止文本换行 */
				overflow: hidden;
				/* 隐藏溢出的文本 */
				text-overflow: ellipsis;
				margin-bottom: 8rpx;
			}

			.num {
				font-size: 26rpx;
				color: #CCCCCC;
			}
		}
	}

	.btn {
		width: 620rpx;
		height: 68rpx;
		background: linear-gradient(270deg, #FDF2CB 0%, #FDF2CB 34%, #F3A46B 100%);
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		font-weight: 500;
		font-size: 32rpx;
		color: #522F00;
		text-align: center;
		line-height: 68rpx;
		position: absolute;
		left: 50%;
		bottom: 34rpx;
		transform: translateX(-50%);
	}

	.info {
		width: 686rpx;
		height: 408rpx;
		margin: 0 auto;
		margin-top: 30rpx;
		position: relative;

		>image {
			position: absolute;
			width: 686rpx;
			height: 408rpx;
		}
	}

	.info_top {
		display: flex;
		align-items: center;
		position: absolute;
		top: 84rpx;
		left: 24rpx;
	}

	.number {
		font-weight: 600;
		font-size: 60rpx;
		color: #FAD9AC;
		margin-right: 30rpx;
	}

	.rate_wrap {
		display: flex;
		align-items: center;
	}

	.rate {
		width: 34rpx;
		height: 34rpx;
		margin-right: 10rpx;
	}

	.allwrap {
		display: flex;
		align-items: center;
		margin-top: 20rpx;
		width: 600rpx;
		position: relative;
		top: 178rpx;
		left: 24rpx;
	}

	.txt {
		font-weight: 400;
		font-size: 26rpx;
		color: #CCCCCC;
		margin-right: 30rpx;
	}

	.progess {
		display: flex;
		flex: 1;
		// width: 400rpx;
		position: relative;
		height: 38rpx;
		margin-right: 14rpx;

		.bgg {
			width: 280rpx;
			height: 30rpx;
			background: #FFB404;
			opacity: 0.2;
			border-radius: 120rpx 120rpx 120rpx 120rpx;
			position: absolute;
			top: 5rpx;
			left: 4rpx;
			/* #ifdef  MP-WEIXIN  */
			width: 300rpx;
			top: 4rpx;
			left: -6rpx;
			/* #endif */
		}

		position: relative;
		display: flex;
		justify-content: space-between;
		align-items: center;
		// margin-top: 28rpx;

		.ssss {
			position: relative;
			z-index: 99;
			margin-left: 15rpx;
			margin-right: 20rpx;
		}

	}

	.price {
		font-weight: 600;
		font-size: 30rpx;
		color: #FAD9AC;
	}

	.prompt {
		width: 600rpx;
		background: #ffffff;
		margin: 0 auto;
		border-radius: 20rpx;
		padding-top: 10rpx;
		padding-bottom: 40rpx;
	}

	.prompt>text {
		margin-top: 40rpx;
	}

	.prompt_tit {
		margin: 0 30rpx;
		font-size: 28rpx;
		color: #666666;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}

	.prompt_ntm {
		width: 100%;
		font-size: 30rpx;
		margin-top: 50rpx;
	}

	.prompt_ntm>text:nth-child(1) {
		width: 200rpx;
		height: 72rpx;
		line-height: 72rpx;
		text-align: center;
		background: #F2F2F2;
		border-radius: 40rpx;
		color: #333333;
	}

	.prompt_ntm>text:nth-child(2) {
		width: 200rpx;
		height: 72rpx;
		line-height: 72rpx;
		text-align: center;
		background: linear-gradient(90deg, #FA2222 2%, #FFC400 98%);
		border-radius: 40rpx;
		color: #ffffff;
	}

	.tagimage {
		width: 126rpx;
		height: 40rpx;
		margin-right: 10rpx;
	}

	.tagwrap {
		margin: 0 auto;
		margin-top: 40rpx;
		margin-left: 34rpx;
		position: relative;
		z-index: 666;
	}

	.rateimg {
		width: 30rpx;
		height: 30rpx;
		margin: 6rpx;

	}

	.jcxx {
		width: 686rpx;
		height: 276rpx;
		margin: 0 auto;
		margin-top: 30rpx;
	

		.jcxxbg {
			width: 686rpx;
			height: 276rpx;
			position: absolute;
		}
	}

	.jcxxitem {
		margin: 0 auto;
		display: flex;
		margin-left: 30rpx;
		margin-right: 30rpx;
		align-items: center;
		justify-content: space-between;
		width: 600rpx;
		padding-top: 100rpx;
		position: relative;
		z-index: 999;
		>text {
			font-weight: 400;
			font-size: 30rpx;
			color: #CCCCCC !important;
		}
	}
	.rightsss{
		display: flex;
		align-items: center;
		font-weight: 400;
		font-size: 30rpx;
		color: #FFFFFF !important;
		>image{
			width: 18rpx;
			height: 24rpx;
			margin-left: 10rpx;
		}
	}
</style>